package com.wc.codeforces.前缀和与差分.前缀和.Outstanding_Impressionist;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/1/5 18:03
 * @description
 * https://codeforces.com/contest/2053/problem/B
 */
public class Main {
    /**
     * 思路：
     * 前缀和 记录 是否 其他的从 l[i] 到 r[i] 确定有
     * l[i] == r[i], 查询 num[l[i]] 是否除了自己还有其他人
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 200010, M = N << 1;
    static int[] l = new int[N], r = new int[N], num = new int[M], sum = new int[M];
    static int n;

    public static void main(String[] args) {
        int T = sc.nextInt();
        while (T-- > 0) {
            n = sc.nextInt();
            Arrays.fill(num, 1, 2 * n + 1, 0);
            for (int i = 1; i <= n; i++) {
                l[i] = sc.nextInt();
                r[i] = sc.nextInt();
                // 只有单独的确认了, 才会确定
                if (l[i] == r[i]) num[l[i]]++;
            }

            for (int i = 1; i <= 2 * n; i++) {
                sum[i] = sum[i - 1];
                if (num[i] > 0) sum[i]++;
            }

            for (int i = 1; i <= n; i++) {
                if (l[i] == r[i]) {
                    if (num[l[i]] > 1) out.print(0);
                    else out.print(1);
                } else {
                    if (sum[r[i]] - sum[l[i] - 1] < r[i] - l[i] + 1) out.print(1);
                    else out.print(0);
                }
            }
            out.println();
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

